package com.cat.model.common.model.common;

import com.alonew.core.commons.model.BaseVO;
import com.alonew.json.JSONException;
import com.alonew.json.JSONObject;
import com.cat.model.common.model.base.IJson;
import com.cat.model.common.model.base.ISimpleJson;

public class Person extends BaseVO implements IJson, ISimpleJson{

	private static final long serialVersionUID = 22772500628919543L;
	
	private int age;
	private String sex;
	private String name;
	private String password;
	
	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	protected String[] escape() {
		return defaultEscape;
	}

	@Override
	protected String table() {
		return "person";
	}

	@Override
	public JSONObject toSimpleJson() {
		JSONObject json = new JSONObject();
		try {
			json.put("id", id);
			json.put("name", name);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return json;
	}

	@Override
	public JSONObject toJson() {
		JSONObject json = new JSONObject();
		try {
			json.put("id", id);
			json.put("name", name);
			json.put("age", age);
			json.put("sex", sex);
			json.put("password", password);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return json;
	}
	
}
